package com;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YJ
 * Date: 2024-4-04
 * Time: 17:42
 */
public class InsertSort {
    /**
     * 插入排序
     *
     * @param array
     */
    public static void InsertSortRecursion(int[] array) {

    }

    private static void insertion(int[] a, int low) {
        if (low == a.length) return;
        int t = a[low];
        int i = low - 1;
        while (i >= 0 && t < a[i]) {
            a[i + 1] = a[i];
            i--;
        }
        //找到插入位置
        if (i != low - 1) {
            a[i + 1] = t;
        }
        insertion(a,low + 1);
    }
}
